#include <stdio.h>

#include "binary_tree.h"

int digui(TreeRoot root)
{
    if (NULL == root) {
    	return 0;
    }	
    int ret = 1;
    int left = 0;
    int right = 0;
    if (root->left) {
    	left = digui(root->left);
    }
    if (root->right) {
    	right = digui(root->right);
    }
    if (left > right) {
    	return ret+left;
    }
    return ret+right;
}

/*
int main()
{
	TreeRoot root = create_binary_tree(10);
	insert_element_into_binary_tree(root, 6);
	insert_element_into_binary_tree(root, 14);
	insert_element_into_binary_tree(root, 4);
	insert_element_into_binary_tree(root, 1);
	insert_element_into_binary_tree(root, 12);
	insert_element_into_binary_tree(root, 16);
	//insert_element_into_binary_tree(root,);
	preorder_print_binary_tree(root);
	printf("\n%d\n", digui(root)); 
}
*/
